import org.kwis.msp.lcdui.Jlet;
import org.kwis.msp.lcdui.Display;

import org.kwis.msp.lwc.Component;
import org.kwis.msp.lwc.ShellComponent;
import org.kwis.msp.lwc.TickerComponent;
import org.kwis.msp.lwc.ButtonComponent;
import org.kwis.msp.lwc.ActionListener;

public class TickerComponentEx2 extends Jlet{

	public class ActionListenerHandler implements ActionListener{
		public void action(Component cmp, Object obj){
			run = !run;
			ticker.setTickerState( run );
		}
	}

	Display displayLCD ;
	ShellComponent shell;	
	TickerComponent ticker;

	boolean run = true;

	public TickerComponentEx2(){  
		displayLCD = Display.getDefaultDisplay();
		shell = new ShellComponent();
	}

	protected void startApp(String[] arg0){
		
		displayLCD = Display.getDefaultDisplay();
		ticker = new TickerComponent("WIPI TickerComponent !!",null);
		shell.setTitle("     Ticker Test ");
		shell.setWorkComponent(ticker);
		
		ButtonComponent togglerButton = new ButtonComponent("Ticker Toggler",null);
		togglerButton.setActionListener(new ActionListenerHandler(), null);

		shell.setCommand(togglerButton,false);
		displayLCD.pushCard(shell.getCard());

		
	}
	protected void destroyApp(boolean arg0) {  }

	

}
